home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 55671 / 55671.xpi / chrome / snipit.jar / content / options.js < prev    next >
Text File  |  2008-04-18  |  2KB  |  44 lines

  1. function snipit_loadOptions()
  2. {
  3.     const prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  4.  
  5.     if (prefs.prefHasUserValue("snipit.ssl"))
  6.     {
  7.         document.getElementById("snipit.ssl").checked = prefs.getBoolPref("snipit.ssl");
  8.     }
  9.     else
  10.     {
  11.         document.getElementById("snipit.ssl").checked = false;
  12.     }
  13.  
  14.     if (prefs.prefHasUserValue("snipit.openpagein"))
  15.     {
  16.         document.getElementById("snipit.openpagein").value = prefs.getComplexValue("snipit.openpagein", Components.interfaces.nsISupportsString).data;
  17.     }
  18.     else
  19.     {
  20.         document.getElementById("snipit.openpagein").value = "tab";
  21.     }
  22.  
  23.     if (prefs.prefHasUserValue("snipit.contextmenuitem"))
  24.     {
  25.         document.getElementById("snipit.contextmenuitem").checked = prefs.getBoolPref("snipit.contextmenuitem");
  26.     }
  27.     else
  28.     {
  29.         document.getElementById("snipit.contextmenuitem").checked = true;
  30.     }
  31. }
  32.  
  33. function snipit_saveOptions()
  34. {
  35.     const prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  36.     const string = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
  37.  
  38.     prefs.setBoolPref("snipit.ssl", document.getElementById("snipit.ssl").checked);
  39.     prefs.setBoolPref("snipit.contextmenuitem", document.getElementById("snipit.contextmenuitem").checked);
  40.  
  41.     string.data = document.getElementById("snipit.openpagein").value;
  42.     prefs.setComplexValue("snipit.openpagein", Components.interfaces.nsISupportsString, string);
  43. }
  44.